#include "pch.h"
#include "CCefBrowserDomVisitor.h"

void CCefBrowserDomVisitor::Visit(CefRefPtr<CefDOMDocument> document)
{
	TestAccess(document);
	TestModify(document);
}

void CCefBrowserDomVisitor::TestAccess(CefRefPtr<CefDOMDocument> document)
{
}

void CCefBrowserDomVisitor::TestModify(CefRefPtr<CefDOMDocument> document)
{
	CefRefPtr<CefListValue> parms = values;
	CefString  szUserName = parms->GetString(0);
	CefString szPassword = parms->GetString(1);
	CefRefPtr<CefDOMNode> username = document->GetElementById("username");
	if (username.get() && !szUserName.empty()) {
		username->SetElementAttribute("value", szUserName);
	}
	CefRefPtr<CefDOMNode> password = document->GetElementById("password");
	if (password.get() && !szPassword.empty()) {
		password->SetElementAttribute("value", szPassword);
	}
}
